import request from '@/utils/request'

// 登录函数
/**
 * @description: 登录函数
 * @param {*} data { mobile,password}
 * @return {*} promise
 */
export function loginAPI({ username, password }) {
  return request({
    url: '/park/login',
    method: 'POST',
    data: {
      username,
      password
    }
  })
}
// 获取行车管理列表
export function getCardListAPI(params) {
  return request({
    url: '/parking/card/list',
    params
  })
}
// 新增月卡
export function createCardAPI(data) {
  return request({
    url: '/parking/card',
    method: 'POST',
    data
  })
}
// 获取月卡详情
export function getCardDetailAPI(id) {
  return request({
    url: `/parking/card/detail/${id}`
  })
}
// 编辑月卡
export function updateCardAPI(data) {
  return request({
    url: 'parking/card/edit',
    method: 'put',
    data
  })
}
// 删除月卡
export function delCardAPI(id) {
  return request({
    url: `/parking/card/${id}`,
    method: 'DELETE'
  })
}
// 批量删除月卡
export function delCardListAPI(idList) {
  return request({
    url: `/parking/card/${idList.join(',')}`,
    method: 'DELETE'
  })
}
